package com.smartalarmclock.Model.Exceptions;

import java.util.Set;

import com.smartalarmclock.Model.IProfile;
import com.smartalarmclock.Model.ITimeFrame.TimeInWeek;

@SuppressWarnings("serial")
public final class ConflictingSchedueledProfilesException extends Exception {
	
	/**
	 * Constructor
	 * @param referencingType the type of the referencing data entity
	 * @param referencingId the id of the referencing data entity
	 * @param referencedType the type of the referenced data entity
	 * @param referencedId the id of the referenced data entity
	 */
	public static String CreateConflictMessage(Set<IProfile> i_ConflictingProfiles, TimeInWeek i_ConflictTime)
	{
		StringBuilder messageBuilder = new StringBuilder();
		
		messageBuilder.append("The following profiles are active and schedueled at the same time:\n");
		for(IProfile profile : i_ConflictingProfiles)
		{
			messageBuilder.append(profile.GetName());
			messageBuilder.append("\n");
		}
		
		messageBuilder.append("The conflicting time is: ");
		messageBuilder.append(i_ConflictTime.toString());
		return messageBuilder.toString();
	}
	
	public ConflictingSchedueledProfilesException(String message) {
		super(message);
	}
}
